﻿using System;
using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace AdonetTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var connectionString = "server=.;datebase=master;uid=sa;pwd=azhana824";

            SqlConnection sqlconnection = new SqlConnection(connectionString);

            sqlconnection.Open();//打开数据库连接

            SqlCommand command = new SqlCommand("select * from cinema", sqlconnection);          

            var reader=command.ExecuteXmlReader();

            Console.WriteLine("{0}\t{1}\t{2}\t{3}", "id" ,"电影","类型","评分");

            while (reader.Read()) 
            {
                Console.WriteLine("{0}\t{1}\t{2}\t{3}",reader["id"], reader["movie"], reader["description"], reader["rating"]);
            }

            sqlconnection.Close();//关闭数据库连接
            
        }
    }
}
